# 集合 可变数据类型

s={}# 创建的是字典
s=set()# 创建的是集合
print(type(s))

print("========================================")

A = {1,2,3,4,5,5}
B = {4,5,6,7,8}

print(A)
print(A&B)
print(A|B)
print(A-B) #差集
print(A^B) #补集

print("=========================================")

A.add(100)
A.remove(1)
print(A)
A.clear()
print(A)

print("=========================================")

# 遍历
for i in B:
    print(i,end=",")
print()

for i,j in enumerate(B,1):
    print(i,"--->",j)

print("=========================================")


# 生成
s = {i for i in range(10)}
print(s)

s = {i for i in range(10) if i%2==1}
print(s)








